#ifndef _Image
#define _Image

//****************************************************************
// Header file of the Main 
//
// Adelailson Peixoto e Fabio Franco 05/05/2003
// Visgraf - IMPA
//
//****************************************************************

#if defined __cplusplus

//#include <IM/im.h>
#include "im.h"
#include <string.h>
#include <stdio.h>

class Image{
private:
   char fileimg[256];
   int  width;
   int  height;
   int  type;
   int  tam_pal;
   unsigned char *r,*g,*b,*rgb;

public:
   Image(void);
   Image(int w, int h);
   Image(int w, int h, int format, unsigned char *redgreenblue, char *f);
   ~Image(void);
   int Load(char *f);
   int Load(char *f, bool invert);
   int Load (Image *img, int ch);
   int LoadSubImage(Image *img, int i0, int j0, int w, int h);
   int CopySubImage(Image *img, int i0, int j0, int w, int h);
   int Save(int format, char *f);
   int Save(int w, int h, int format, unsigned char *r, unsigned char *g, unsigned char *b, char *f);
   int Save(int w, int h, int format, unsigned char *rgb, char *f);
   void GetR(unsigned char **red);
   void GetG(unsigned char **green);
   void GetB(unsigned char **blue);
   int GetType(void){return type;}
   int GetTamPal(void){return tam_pal;}
   void GetRGB(unsigned char **red,unsigned char **green,unsigned char **blue);
   void GetRGB(unsigned char **rgb);
   void GetDim(int *w, int *h);
   unsigned char GetR(int i,int j);
   unsigned char GetG(int i,int j);
   unsigned char GetB(int i,int j);
   unsigned char GetR(int i);
   unsigned char GetG(int i);
   unsigned char GetB(int i);
   void GetRGB(int i, unsigned char *red,unsigned char *green,unsigned char *blue);
   void SetRGB(int i, unsigned char red,unsigned char green,unsigned char blue);
   void SetRGB(int i, int j, unsigned char red, unsigned char green, unsigned char blue);
   void SetRGB(unsigned char *redgreenblue);
   void SetType(int t);
   void SetTamPal(int tam);
   float GetGray(int i,int j);
   float GetGray(int i);
   int  IsEmpty(void);
   void  Unload(void);
   int GetW(){return width;}
   int GetH(){return height;}
   char *GetFilename() { return fileimg; }

};

#endif /* __cplusplus */
#endif /* _Main */ 
